package com.thread.functioninterface;

import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

/**
 * @author xuejingjing
 * @className PredicateTest
 * @description TODO
 * @date 2022/11/12/012 18:32
 */
public class PredicateTest {
    public static void main(String[] args) {
        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
        //
        Predicate<Integer> predicate = t -> t%2 ==0;
        List<Integer> collect = list.stream().filter(predicate).collect(Collectors.toList());
        System.out.println(collect);
    }
}
